const axios = require('axios');
const FormData = require('form-data');
axios.defaults.withCredentials = true

let mydata = new FormData();
mydata.append('Cookie', "token=it_token:1656853695.91139584578");
mydata.append('Accept', "application/json, text/plain, */*");
mydata.append('Content-Type', "application/json;charset=UTF-8");

function save(){
    setInterval(() => {

        axios({
            method: 'POST',
            url: 'https://www.helloworldcoding.com/api/save',
            data: {
                "content": "<p>2</p>",
                "label_ids": "",
                "title": "1",
                "abstract": "2\n",
                "abstract_img": ""
              },
            headers:{
                'Cookie': "token=it_token:1656916030.78516773908",
                'Accept': "application/json, text/plain, */*",
                'Content-Type': "application/json;charset=UTF-8",
            } // 这个地方大坑，headers自己写multipart/form-data会出问题[恶心死了]，必须写这个
        
        }).then (res => {
            console.log('save', res)
        }).catch(err => {
            console.log(err)
        })
    },5000)
}
let count = 1;
function aaa (){
    setInterval(() => {

        axios({
            method: 'POST',
            url: 'https://www.helloworldcoding.com/api/add-comment',
            data: {
                "content": "{\"text\":\"4\"}",
                "article_id": 34,
                "obj_id": 34,
                "obj_type": 1
            },
            headers:{
                'Cookie': "token=it_token:1656916030.78516773908",
                'Accept': "application/json, text/plain, */*",
                'Content-Type': "application/json;charset=UTF-8",
            } // 这个地方大坑，headers自己写multipart/form-data会出问题[恶心死了]，必须写这个
        
        }).then (res => {
            console.log('aaa', res)
        }).catch(err => {
            console.log(err)
        })
    },3000)
}
aaa();
// save();